package triangle;

public class Triangle {

	private float a;
	private float b;
	private float c;

	private boolean isosceles;

	public Triangle(float _a, float _b, float _c) throws TriangleException {

		a = _a;
		b = _b;
		c = _c;

		float biggest = Math.max(Math.max(a, b), c);

		isosceles = false;

		if (a == b || c == b || a == c)
			isosceles = true;

		if (c == biggest)
			if (c >= (a + b)) {
				throw new TriangleException(
						"Can not build a Triangle. Invalid Input");
			}

		if (b == biggest)
			if (b >= (a + c)) {
				throw new TriangleException(
						"Can not build a Triangle. Invalid Input");
			}

		if (a == biggest)
			if (a >= (c + b)) {
				throw new TriangleException(
						"Can not build a Triangle. Invalid Input");

			}

	}
	
	public boolean isIsosceles(){
		return isosceles;
	}
	
	public String toString(){
		
		return "a: "+a+"\nb: "+b+"\nc: "+c;
	}
	
}
